﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Baza.EF.BLL;
using Baza.EF.DAL;

namespace Pep_3014_3070.Owners
{
    public partial class ConfirmReservation : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                BindData();
            }
        }

        private void BindData()
        {
            RezervacijeRepeater.DataSource = DAOwners.getReservationByID(Convert.ToInt32(HttpContext.Current.User.Identity.Name));
            RezervacijeRepeater.DataBind();
        }

        protected void RezervacijeRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "PotvrdiBtn")
            {
                DAOwners.ConfirmReservation(Convert.ToInt32(e.CommandArgument));
                BindData();

            }
            if (e.CommandName == "OtkaziBtn")
            {
                DAOwners.CancelReservation(Convert.ToInt32(e.CommandArgument));
                BindData();
            }
        }
    }
}